package sort;
//双指针法
public class quick3 {
    public static void a(int [] arr,int left,int right){
        if (left>=right){
            return;
        }
        int div=b(arr,left,right);
//        左边递归
        a(arr,left,div);
//        右边递归
        a(arr,div+2,right);
    }
    public static int b(int[]arr,int left,int right){
        int i=left,j=left+1;
        while (j<=right){
            while (arr[j]<arr[left]&&(++i)<j){
                swap(arr,j,i);
            }
            j++;
        }
        swap(arr,i,left);
        return i-1;
    }
    public static void swap(int[]arr,int a,int b){
        int temp=arr[a];
        arr[a]=arr[b];
        arr[b]=temp;
    }
}
